#include "text_query.h"
#include <fstream>

int main(int argc, char *argv[])
{
    if (argc < 2) {
        cout << "Please specify file name to be processed!" << endl;
        return -1;
    }

    ifstream is(argv[1]);
    TextQuery tq(is);
    string word;
    while (true) {
        cout << "Please input a word to query: ";
        if (!(cin >> word) || word == "q") {
            break;
        }
        print(cout, tq.query(word));
    }

    return 0;
}
